<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
<link href="<c:url value='/css/dtree.css'/>" rel="stylesheet">
<script src="<c:url value='/js/dtree.js'/>"></script>
<%-- <script src="<c:url value='/js/jquery.min.js'/>"></script> --%>
<%-- <script src="<c:url value='/js/jquery.ui.position.js'/>"></script>
<script src="<c:url value='/js/jquery.contextMenu.js'/>"></script>
<link href="<c:url value='/css/jquery.contextMenu.css'/>"/> --%>
<script src="<c:url value='/js/jquery.contextmenu.r2.js'/>"></script>
<script src="<c:url value='/js/menu.js'/>" ></script>
<!-- <script>
$(function(){
	$.contextMenu({
        selector: '#project-menu-tree', 
        callback: function(key, options) {
            var m = "clicked: " + key;
            window.console && console.log(m) || alert(m); 
        },
        items: {
            "edit": {name: "Edit"},
        }
    });
	 $('#project-menu-tree').on('click', function(e){
	        console.log('clicked', this);
	  });
});
</script> -->

<div class="">
	<div class="well-large sidebar-nav" >
		<ul class="nav nav-list">
			<li class="nav-header">
				<h3 id="project-name">
					项目
<!-- 					<button class="btn" style="float: right"
						data-target="#add_project_panel" data-toggle="modal"
						data-backdrop="false">
						<i class="icon-plus"></i> 增加
					</button> -->
				</h3>
			</li>
			<li id="project-menu-tree">
			     
			</li>
			<script type="text/javascript">
/*				d = new dTree('d');
				//level 0
				d.add(0, -1, '<c:out value="${project.name}"></c:out>');
				//level 1
			    d.add(1, 0, '架构模板','#', '','',''); 
                d.add(2, 0, '设计模式','#', '','',''); 
                //level 3 
                d.add(3, 1, '系统架构',''); 
                d.add(4, 1, 'AADL文档',''); 
                //level 3
                d.add(5, 2, '实体数据区','/ManEnv/entityZone/'+ '<c:out value="${project.name}"></c:out>' + '/list'); 
                d.add(6, 2, '总线通信','/ManEnv/project/' + '<c:out value="${project.name}"></c:out>' + '/design_pattern_component/BUS'); 
                d.add(7, 2, 'IO通信','/ManEnv/project/' + '<c:out value="${project.name}"></c:out>' + '/design_pattern_component/IO');  
                d.add(8, 2, '信息显示','/ManEnv/project/' + '<c:out value="${project.name}"></c:out>' + '/design_pattern_component/DISPLAY'); 
                d.add(9, 2, '控制响应','/ManEnv/project/' + '<c:out value="${project.name}"></c:out>' + '/design_pattern_component/CONTROL'); 
				
			
  				d.add(0, -1, '  项目详细');
				var index = 1;
				var projectIndex = 0;
				var projectIdArray = new Array();
				<c:forEach items="${projects}" var="project" varStatus="status">
                ++projectIndex;
			    d.add('<c:out value="${status.count}"></c:out>',0 ,'<c:out value="${project.name}"></c:out>',
								'/ManEnv/project/list/<c:out value="${project.id}"></c:out>');
			    projectIdArray[projectIndex -1] = '<c:out value="${project.id}"></c:out>';
			    ++index;
				</c:forEach>
				for (var i = 1; i <= projectIndex; ++i){
					var tmp = index;
					//d.add(index, i, '架构模板','#', '','','/ManEnv/img/dtree/calendar.svg'); ++index;
					d.add(index, i, '架构模板','#', '','',''); ++index;
                    d.add(index, tmp, '查看系统架构',''); ++index;
                    d.add(index, tmp, '更新系统架构','');  ++index;
                    d.add(index, tmp, '查看AADL文档',''); ++index;
                    d.add(index, tmp, '下载AADL文档',''); ++index;
					tmp = index;
					//d.add(index, i, '设计模式','#', '','','/ManEnv/img/dtree/notebook.svg'); ++index;
					d.add(index, i, '设计模式','#', '','',''); ++index;
					d.add(index, tmp, '实体数据区','/ManEnv/entityZone/'+ projectIdArray[i-1] + '/list'); ++index;
				    d.add(index, tmp, '总线通信','/ManEnv/project/' + projectIdArray[i-1] + '/design_pattern_component/BUS'); ++index;
	                d.add(index, tmp, 'IO通信','/ManEnv/project/' + projectIdArray[i-1] + '/design_pattern_component/IO');  ++index;
	                d.add(index, tmp, '信息显示','/ManEnv/project/' + projectIdArray[i-1] + '/design_pattern_component/DISPLAY'); ++index;
                    d.add(index, tmp, '控制响应','/ManEnv/project/' + projectIdArray[i-1] + '/design_pattern_component/CONTROL'); ++index;
                    
                    
				}   */
				//document.write(d);
				
			</script>
		</ul>
	</div>
</div>
<div class="contextMenu" id="myMenu1">
      <ul>
        <li id="lookup"><img src="<c:url value='/img/contextMenu/page_white_edit.png'/>"/>查看</li>
        <li id="edit"><img src="<c:url value='/img/contextMenu/page_white_add.png'/>" />编辑</li>
        <li id="export"><img src="<c:url value='/img/contextMenu/redo.png'/>" />导出</li>
        <li id="update"><img src="<c:url value='/img/contextMenu/page_white_edit.png'/>" />更新</li>
        <li id="delete"><img src="<c:url value='/img/contextMenu/page_white_delete.png'/>" />删除</li>
      </ul>
</div>
<div class="contextMenu" id="designpattern-menu" >
      <ul style="width:150px">
        <li id="use"><img src="<c:url value='/img/contextMenu/page_white_edit.png'/>"/>复用</li>
        <li id="import"><img src="<c:url value='/img/contextMenu/page_white_add.png'/>" />导入Rhapsody文件</li>
      </ul>
</div>
<%-- <div class="modal hide fade" id="add_project_panel">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal"
			aria-hidden="true">&times;</button>
		<h3>添加新项目</h3>
	</div>
	<form class="form-horizontal"
		action="<%=request.getContextPath()%>/project/add" method="post">
		<div class="modal-body">
			<div class="control-group">
				<label class="control-label" for="variable_name">项目名称</label>
				<div class="controls">
					<input type="text" name="name" placeholder="名称">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="variable_name">项目描述</label>
				<div class="controls">
					<textarea rows='4' name="description" placeholder="描述"></textarea>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn " type="submit" id="add_project_btn">
				<i class="icon-ok"></i> 保存
			</button>
			<button class="btn" type="reset" data-dismiss="modal"
				aria-hidden="true">
				<i class="icon-remove"></i> 关闭
			</button>
		</div>
	</form>
</div>
 --%>